<template>
	<scroll-view :refresher-enabled="load" :refresher-triggered	="isRefresh" @refresherrefresh="handlerefresh" :style="{height: height}" :scroll-top="scrollTop" scroll-y="true" :lower-threshold="20"
		@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
		<slot name="list"></slot>
		<!-- <cu-more v-if="isMore" content="正在加载" icon="loading2"></cu-more> -->
	</scroll-view>
</template>

<script setup lang="ts">
	import {
		ref
	} from 'vue';
	const emit = defineEmits(['action', 'loadmore', 'refresh']);
	const scrollTop = ref(0)
	const old = {
		scrollTop: 0
	}
	const props = defineProps({
		height: {
			type: String,
			default: '80vh'
		},
		load: {
			type: [Boolean, String],
			default: false
		}
	});
	const isMore = ref(false)
	const isRefresh = ref(false)
	const scroll = (e: any) => {
		old.scrollTop = e.detail.scrollTop
	}
	const handlerefresh=(e:any)=>{
		isRefresh.value = true
		setTimeout(() => {
			isRefresh.value = false
			emit('refresh')
		}, 2000)
	}
	const upper = (e: any) => {
		
	}
	const lower = (e: any) => {
		isMore.value = true
		setTimeout(() => {
			isMore.value = false
			emit('loadmore')
		}, 2000)
	}
</script>

<style>
</style>
